<!--#include file="../nav/admin_top.php" -->
<!--#include file="../nav_menu/report_top.php" -->

<div class="menuBg">
	<a class="menuReturn" href="/admin_report/index">返回所有报表</a>
  <div style="clear:both"></div>
</div>
<div class="margin20">
	<div style="padding-bottom:5px;border-bottom:1px solid #999999;" >{$rpt.name}</div>
</div>
<div class="margin10">
	<fieldset style="border: 1px solid #ccc; padding: 20px;">
		<legend style="color: green">过滤条件</legend>
		<div id="filter_bar">
			<table class="filtertb" >
				<tr>
					<td class="filtertb_l" >
						<form action="/admin_report/result" method="post" id="form1" target="result_iframe">
							<input type="hidden" id="model" name="model" value="{$rpt.model}" />
							<input type="hidden" id="action" name="action" value="{$rpt.action}" />
							<input type="hidden" id="title" name="title" value="{$rpt.name}" />
							
							
							
							<input type="hidden" id="downloads" name="downloads" value="0" />
							<input type="hidden" id="searchdata" name="searchdata" value="" />
							
							<table class="searchtb">
								<tr>
									<th>订单配送时间：</th>
									<td>
										<span>
											<select id="search_dateslt"  class="textBox" onChange="fnSearchDate()">
												<option value="1"  selected="selected">今天</option> 
												<option value="2"  >本周</option> 
												<option value="3">本月</option> 
												<option value="">自定义时间段</option> 								
											</select>
										</span>
										<span id="s_date_div" style="display:none;margin:5px auto;">
											从 <input type="text" class="textBoxDate" id="b_date" value=""   maxlength="10" />
											<input id="b_date_slt" class="btnicon_calendar" type="button">
											到
											<input type="text" class="textBoxDate" id="e_date" value=""   maxlength="10" />
											<input id="e_date_slt" class="btnicon_calendar" type="button">
										</span>	
									</td>
								</tr>
								<tr>
									<th>订单状态：</th>
									<td>
										<input type="checkbox" id="status02" /><label for="status02">系统取消</label>
										<input type="checkbox" id="status01" /><label for="status01">用户取消</label>
										<input type="checkbox" id="status1"  checked="checked" /><label for="status1">等待审核</label>
										<input type="checkbox" id="status2"  checked="checked" /><label for="status2">已审核，等待生成</label>
										<input type="checkbox" id="status3"  checked="checked" /><label for="status3">已生产，等待配送</label>
										<input type="checkbox" id="status4"  checked="checked"  /><label for="status4">已配送</label>
									</td>
								</tr>
							</table>
						</form>
					</td>
					<td class="filtertb_r">
						<button onclick="fnView()">预览</button>
						<button onclick="fnExport()" style="margin-left:20px">导出报表 </button>
					</td>
				</tr>
			</table>
		</div>
	</fieldset>				
</div>
<div class="report_outer">
	<div id="result_div">
		<iframe id="result_iframe" name="result_iframe" style="width:950px;height:450px;border:1px dashed #CCCCCC;"></iframe>
	</div>
</div>
<script type="text/javascript">
$().ready(function(){
	o2js.build('jscalendar');
	o2js.build('dates');
	fnSetSltDate('b_date','b_date_slt');
	fnSetSltDate('e_date','e_date_slt');
	fnSearchDate();
}); 
function fnSearchDate(){
	$('#s_date_div').hide();
	var date = new Date();
	switch($('#search_dateslt').val()){
		case "0"://  
			$('#b_date').val('');
			$('#e_date').val('');
			break;
		case "1"://  
			$('#b_date').val(today());
			$('#e_date').val(today());
			break;
		case "2":// 
			var b = getWeekFirst(date).eformat('yyyy-MM-dd');
			var e = getWeekLast(date).eformat('yyyy-MM-dd'); 
			$('#b_date').val(b);
			$('#e_date').val(e);
			break;
		case "3"://本月
			var b = getMonthFirst(date).eformat('yyyy-MM-dd');
			var e = getMonthLast(date).eformat('yyyy-MM-dd'); 
			$('#b_date').val(b);
			$('#e_date').val(e);
			break;
		default:
			$('#s_date_div').show();
			break;
	}
}
function fnGetSearchData(){
	var status = [];
	if($('#status02').attr('checked')){
		status.push('-2');
	}
	if($('#status01').attr('checked')){
		status.push('-1');
	}
	if($('#status1').attr('checked')){
		status.push('1');
	}
	if($('#status2').attr('checked')){
		status.push('2');
	}
	if($('#status3').attr('checked')){
		status.push('3');
	}
	if($('#status4').attr('checked')){
		status.push('4');
	}
	if(status.length <= 0){
		alert('请至少选择一个 订单状态');
		return false;
	}
	var ret={
		b_date:$('#b_date').val(),
		e_date:$('#e_date').val(),
		status:status.join(',')
	};
	return JSON.encode(ret);
}
</script>
<!--#include file="../nav/admin_bottom.php" -->